package user;

import book.BookList;
import operations.IOperation;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-07-07
 * Time: 20:00
 */
public abstract class User {
    protected String name;  //用protected修饰，不同包下的子类可以访问
    protected IOperation[] iOperations;
    //构造方法
    public User(String name) {
        this.name = name;
    }

    public abstract int menu(); //重写menu方法

    //这个方法为我们执行我们需要执行的操作
    public void doIOperation(int choice, BookList bookList) {  //choice 表示选择的操作  bookList 表示被操作的书架
        iOperations[choice].work(bookList);
    }
}
